
package br.ufscar.sor.ppgccs.educatransito.entidade;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Joaquim
 */
@Entity
@Table(name = "comentarios")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Comentarios.findAll", query = "SELECT c FROM Comentarios c"),
    @NamedQuery(name = "Comentarios.findByIdcomentarios", query = "SELECT c FROM Comentarios c WHERE c.idcomentarios = :idcomentarios"),
    @NamedQuery(name = "Comentarios.findByDtComentario", query = "SELECT c FROM Comentarios c WHERE c.dtComentario = :dtComentario")})
public class Comentarios implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idcomentarios")
    private Integer idcomentarios;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "comentario")
    private String comentario;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dtComentario")
    @Temporal(TemporalType.DATE)
    private Date dtComentario;
    @JoinColumn(name = "idUsuario", referencedColumnName = "idUsuario")
    @ManyToOne(optional = false)
    private Usuario idUsuario;
    @JoinColumn(name = "idforum", referencedColumnName = "idforum")
    @ManyToOne(optional = false)
    private Forum idforum;

    public Comentarios() {
    }

    public Comentarios(Integer idcomentarios) {
        this.idcomentarios = idcomentarios;
    }

    public Comentarios(Integer idcomentarios, String comentario, Date dtComentario) {
        this.idcomentarios = idcomentarios;
        this.comentario = comentario;
        this.dtComentario = dtComentario;
    }

    public Integer getIdcomentarios() {
        return idcomentarios;
    }

    public void setIdcomentarios(Integer idcomentarios) {
        this.idcomentarios = idcomentarios;
    }

    public String getComentario() {
        return comentario;
    }

    public void setComentario(String comentario) {
        this.comentario = comentario;
    }

    public Date getDtComentario() {
        return dtComentario;
    }

    public void setDtComentario(Date dtComentario) {
        this.dtComentario = dtComentario;
    }

    public Usuario getIdUsuario() {
        return idUsuario;
    }

    public void setIdUsuario(Usuario idUsuario) {
        this.idUsuario = idUsuario;
    }

    public Forum getIdforum() {
        return idforum;
    }

    public void setIdforum(Forum idforum) {
        this.idforum = idforum;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcomentarios != null ? idcomentarios.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Comentarios)) {
            return false;
        }
        Comentarios other = (Comentarios) object;
        if ((this.idcomentarios == null && other.idcomentarios != null) || (this.idcomentarios != null && !this.idcomentarios.equals(other.idcomentarios))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.ufscar.ppgccs.educatransito.entidade.Comentarios[ idcomentarios=" + idcomentarios + " ]";
    }
    
}
